Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Cloud connections #163

Merged
merged 2 commits into from
Jul 30, 2024
Merged

Feat: Cloud connections #163

merged 2 commits into from
Jul 30, 2024

Conversation

tuul-wq
Copy link
Contributor

@tuul-wq tuul-wq commented Jul 26, 2024

  • Request data from CloudStorage for previously saved connections
  • Update CloudStorage when asset is connected/disconnected

= Task =

@tuul-wq tuul-wq self-assigned this Jul 26, 2024
'0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe': true, // KUSAMA
'0x68d56f15f85d3136970ec16946040bc1752654e906147f7e43e9d539d7c3de2f': true, // DOT_ASSET_HUB
'0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e': true, // WESTEND
export const DEFAULT_CONNECTED_CHAINS: Record<ChainId, AssetId[]> = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case we have more than one asset to connect

expect(scope.getState(networkModel._internal.$chains)).toEqual(mockedChainsMap);
});

test('should add metadata subscription after createProviderFx effect', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty useless test

Copy link

github-actions bot commented Jul 26, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 17.13% 1228 / 7166
🔵 Statements 17.13% 1228 / 7166
🔵 Functions 20.5% 41 / 200
🔵 Branches 49.08% 107 / 218
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
app/common/utils/chains.ts 100% 100% 100% 100%
app/models/network/network-model.ts 88.17% 93.1% 76.92% 88.17% 90-92, 95-96, 107-108, 118-141, 149-154, 319-322, 351-354, 356-360, 421-423, 450, 469-475
app/routes/exchange/select.tsx 0% 0% 0% 0% 1-80
Generated in workflow #170

await allSettled(networkModel._internal.requestMetadataFx, { scope, params: {} as ApiPromise });

expect(scope.getState(networkModel._internal.$metadata)).toEqual([mockMetadata]);
});

test('should connect to default_chains on networkStarted event', async () => {
const scope = fork();
vi.spyOn(chainsApi, 'getChainsData').mockResolvedValue(mockedChains);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mock API in order to make sure effect logic works as intended

@@ -173,16 +182,30 @@ sample({
});

sample({
clock: combineEvents([populateChainsFx.doneData, getConnectedAssetsFx.doneData]),
clock: requestChainsFx.doneData,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Connect default chains as soon as they come, not waiting for CloudStorage

Base automatically changed from feat/balances to feat/assets July 30, 2024 13:39
@tuul-wq tuul-wq merged commit 65e6204 into feat/assets Jul 30, 2024
1 check passed
@tuul-wq tuul-wq deleted the feat/cloud_connections branch July 30, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants